package top.buyibuyi.course.controller.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buyibuyi.course.R;
import top.buyibuyi.course.pojo.Semester;
import top.buyibuyi.course.service.admin.SaveSemesterService;

@RestController
@RequestMapping("/semester")
@CrossOrigin
public class SaveSemesterController {
    @Autowired
    private SaveSemesterService saveSemesterService;

    @PostMapping("/saveSemester")
    public R saveSemester(@RequestBody Semester semester){
        System.out.println("==========="+semester);
        try {
            Boolean aBoolean = saveSemesterService.saveSemester(semester);
            return R.ok().data("data",aBoolean);
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}
